import QtQuick 2.0

Rectangle{
    id: root
    width:  800; height: 300
    VisualItemModel{
        id: menuListModel
        FileMenu{
            width: menuListView.width
            height: menuListView.height
        }
        EditMenu{
            width: menuListView.width
            height: menuListView.height
        }
    }

    ListView{
        id: menuListView
        anchors.fill: parent
        width: parent.width; height: parent.width
        anchors.bottom: parent.bottom

        model: menuListModel
        snapMode: ListView.SnapOneItem
        orientation: ListView.Horizontal
        boundsBehavior: Flickable.StopAtBounds
        flickDeceleration: 5000
        highlightFollowsCurrentItem: true
        highlightMoveDuration: 240
        highlightRangeMode: ListView.StrictlyEnforceRange
    }

    Rectangle{
        id: labelList
        anchors.top:  parent.top;
        anchors.horizontalCenter:  parent.horizontalCenter
        width: parent.width; height: 40
        color: "blue"
        z: 1
        Row{
            anchors.centerIn: parent
            spacing: 40
            MyButton{
                width: 60; height: labelList.height
                label: "File"
                id: fileButton
                onButtonClicked: { menuListView.currentIndex = 0; }
            }
            MyButton{
                label: "Edit"
                width: 60; height: labelList.height
                id: editButton
                onButtonClicked: { menuListView.currentIndex = 1; }
            }
        }
    }
}

